package code.tools.gameIni
{
	import code.main.AppData;
	import code.untils.GameConst;

	/**
	 *加载项 
	 * @author Yuri
	 * 
	 */
	public class LoadItem
	{
		/**
		 *名称 
		 */
		public var name:String;
		/**
		 *类型 
		 */
		public var type:String;
		/**
		 *路径 
		 */
		public var path:String;
		/**
		 *语言 
		 */
		public var lang:String ="all";
		public function LoadItem()
		{
		}
		
		public static function parserData(dXml:XMLList,loadItem:LoadItem=null):LoadItem{
			if(!loadItem) loadItem = new LoadItem();
			loadItem.name = dXml.@name;
			loadItem.type = dXml.@type;
			if(loadItem.name=="language" || loadItem.name=="outini"){
				if(loadItem.name=="language" && GameConst.isLocal){
					loadItem.path = AppData.fileUrl + "files/config/langue_"+AppData.language+".xml";
				}else{
					loadItem.path = AppData.configUrl + dXml.@path+"?"+Math.random();
				}
			}else{
				loadItem.path = AppData.fileUrl + dXml.@path;
			}
			loadItem.lang = dXml.@lang;
			return loadItem;
		}
	}
}